package cn.wolfcode.luowowo.common.util;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

@Getter@Setter
public class AjaxResult implements Serializable {
    public static final int NO_LOGIN_CODE = 102;
    private int code;
    private boolean success = true;
    private String msg;
    private Object data;

    public AjaxResult mark(String msg) {
        this.msg = msg;
        success = false;
        return this;
    }

    public AjaxResult addData(Object data) {
        this.data = data;
        return this;
    }
    public AjaxResult addCode(int code) {
        this.code = code;
        return this;
    }

    //错误: 状态为true, 带信息, 带状态码
    public AjaxResult(String msg, int code) {
        this.success = false;
        this.msg = msg;
        this.code = code;
    }

    //正确状态
    public AjaxResult() {

    }


}
